import cv2 as cv
import numpy as np

def showImg(x):
    ret, threshImg = cv.threshold(img, x, 255, cv.THRESH_BINARY | cv.THRESH_OTSU)
    print(ret)
    cv.imshow('imgWin', threshImg)

img = cv.imread("assets/book.jpg", 0)
cv.imshow('imgWin', img)

# 创建滑块,注册拖动时的回调函数 showImg
cv.createTrackbar('slider', 'imgWin', 100, 255, showImg)

cv.waitKey(0)


